package com.dure.hotmemory.scenes;

import android.os.Build;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.TextView;

import com.dure.commonlib.util.ApplicationUtils;
import com.dure.hotmemory.R;
import com.dure.hotmemory.drawview.BaseSurfaceView;

/**
 * Created by leix on 12/12/2016.
 */

public class AboutAppScene extends BaseScene {
    FrameLayout backFL;
    TextView appVersionTV;

    public AboutAppScene(BaseSurfaceView baseSurfaceView) {
        super(baseSurfaceView);
        initData();
    }

    @Override
    public void initData() {
        sceneView = LayoutInflater.from(activity).inflate(R.layout.about_app_layout, null);

        findViews();
        addListener();
        initView();
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            backFL.setBackgroundResource(R.drawable.white_planet_drawable);
        }else{
            backFL.setBackgroundResource(R.drawable.white_circle_drawable);
        }
    }

    private void findViews() {
        backFL = (FrameLayout) sceneView.findViewById(R.id.back_fl);
        appVersionTV = (TextView) sceneView.findViewById(R.id.app_version_tv);

    }

    private void addListener() {
        backFL.setOnClickListener(activity);
    }

    private void initView(){
        appVersionTV.setText("v" + ApplicationUtils.getAppVersionName(activity));
    }

    @Override
    public void viewClicked(View view) {
        switch (view.getId()){
            case R.id.back_fl:
                activity.onBackPressed();
                break;

        }
    }


}
